package cn.edu.buaa.common;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

//sigleton
public class PropertiesHelper {
	
	static Properties properties = null;
	
	static String filename = "ic.properties";
	
	private static void init() {
		try {
			properties = new Properties();
			InputStream stream = PropertiesHelper.class.getClassLoader().getResourceAsStream(filename);
			properties.load(stream);
			stream.close();
		} catch (IOException e) {
			
			e.printStackTrace();
		}
		
	}
	
	private PropertiesHelper() throws IOException {
	}
	
	
	public static Properties getPropertiesInstance() {
		if (null == properties) {
			init();
		}
		
		return properties;
	}
	
	public static String getPropertiesValue(String key) {
		if (null == properties) {
			init();
		}
		
		return properties.getProperty(key);
	}
	
}
